/*********************
* Author:Dzlua
* QQ:505544956
* time:2016/06/27
*/
#ifndef __ED_SINGLETON_H__
#define __ED_SINGLETON_H__

#include "../defines.h"

EDUI_NAMESPACE_BEGIN
	
template<class T>
class Singleton
{
public:
	Singleton()
	{
		m_t = static_cast<T*>(this);
	}
	virtual ~Singleton()
	{
		m_t = nullptr;
	}
	static T* SingletonPtr()
	{
		return m_t;
	}
	static T& SingletonRef()
	{
		return *m_t;
	}
private:
	static T *m_t;
};

template<class T>
T* Singleton<T>::m_t = nullptr;

EDUI_NAMESPACE_END

#endif